Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add interactive mode #52

Merged
merged 8 commits into from
Aug 5, 2018
Merged

Add interactive mode #52

merged 8 commits into from
Aug 5, 2018

Conversation

danielgrijalva
Copy link
Contributor

This covers one of your future plans for textgenrnn:

Supervised text generation mode: allow the model to present the top n options and user select the next char/word (reference)

Demo

word_level_demo

It also works with character-level!
char_level_demo

- User can now choose from top N options for the next char/word
- To initialize interactive mode, pass `interactive=True` in generate()
- By default, n=3. To increase/decrease, pass `top_n=N`
- User can undo a choice by typing `x`
- To stop interactivity, type `s`. This will print the final text to console
- Prints the chosen chars/words to console as the user picks them
- Also, fixed IndexError when trying to delete a char/word from an empty
list
- Fixed bug where the first char of the generated text was getting
removed on interactive mode
@minimaxir
Copy link
Owner

Wow! I'll test this around a bit before merging but this looks like incredible work! (and thanks for the GIF demos!)

- User can type `o` to add a word not listed in the top N options
- This helps the user avoid dead-end situations
- Doesn't work very well if the entered word is not in the vocab
@danielgrijalva
Copy link
Contributor Author

Hey, just added some things. One of them is the ability to manually add a char/word if the user doesn't like any of the top N options:

word_level_demo

@minimaxir minimaxir merged commit 46e2232 into minimaxir:master Aug 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants